import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '任务包名称',
    align:"center",
    dataIndex: 'taskPackageName'
   },
   {
    title: '天数',
    align:"center",
    dataIndex: 'days'
   },
   {
    title: '音符数量',
    align:"center",
    dataIndex: 'noteNum'
   },
   {
    title: '任务包介绍',
    align:"center",
    dataIndex: 'content'
   },
   {
    title: '是否购买',
    align:"center",
    dataIndex: 'isBuy'
   },
   {
    title: '购买次数',
    align:"center",
    dataIndex: 'buyNum'
   },
   {
    title: '剩余时长',
    align:"center",
    dataIndex: 'remainingTime'
   },
   {
    title: '剩余音符数',
    align:"center",
    dataIndex: 'remainingNoteNum'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '任务包名称',
    field: 'taskPackageName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入任务包名称!'},
          ];
     },
  },
  {
    label: '天数',
    field: 'days',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入天数!'},
          ];
     },
  },
  {
    label: '音符数量',
    field: 'noteNum',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入音符数量!'},
          ];
     },
  },
  {
    label: '任务包介绍',
    field: 'content',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入任务包介绍!'},
          ];
     },
  },
  {
    label: '是否购买',
    field: 'isBuy',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入是否购买!'},
          ];
     },
  },
  {
    label: '购买次数',
    field: 'buyNum',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入购买次数!'},
          ];
     },
  },
  {
    label: '剩余时长',
    field: 'remainingTime',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入剩余时长!'},
          ];
     },
  },
  {
    label: '剩余音符数',
    field: 'remainingNoteNum',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  taskPackageName: {title: '任务包名称',order: 0,view: 'text', type: 'string',},
  days: {title: '天数',order: 1,view: 'text', type: 'string',},
  noteNum: {title: '音符数量',order: 2,view: 'text', type: 'string',},
  content: {title: '任务包介绍',order: 3,view: 'text', type: 'string',},
  isBuy: {title: '是否购买',order: 4,view: 'text', type: 'string',},
  buyNum: {title: '购买次数',order: 5,view: 'text', type: 'string',},
  remainingTime: {title: '剩余时长',order: 6,view: 'text', type: 'string',},
  remainingNoteNum: {title: '剩余音符数',order: 7,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}